The SCake SDK is a quick and easy way to set up integrations with Project Sugar Cake for making modules and accessing the API.

(_) How To Install (_)
Simply copy the "Mods" folder into the "Content" folder of your devkit / UE5 environment, then load up your usual project. (The assets are uncooked, so they import directly and can be accessed easily)

(_) Usage Instructions (_)
The SDK provides 'dummy' files/assets you point your mod to, then when you export your mod and load it in-game with Project Sugar Cake also installed, the mod will access the SCake API and trigger the appropriate functions/effects. DO NOT include the SDK files with your mod, this will break SCake and the API, I've set up an asset label that should keep it separated, but double check the chunkID to make sure it doesn't conflict with your mod if you use the packaging method!

When importing the SDK, do not change the file path/structure for the ProjectSugarCake folder! The file path must match exactly in order for the API to work properly (also don't change the DataStructure folder at all). The Data Structure folder has internal structure files for SCake required to properly compile certain API functions. Technically, if you don't wish to install the API or have issues with the provided one, you can still create a "dummy actor" in the appropriate folder and re-create the functions/events seen in the SDK to still access the functions properly (Check definitions below for names and variables). Similarly, if there are API functions you're not using you can remove them from your instance of the SDK if you ever find a reason to do so. (This can be useful if an update broke a certain function and the SDK hasn't been updated to fix it yet)

	!!!!!!
(_) Arb Variables and Saving Notes (_)

For memory and file saving weight concerns, and stats added at run-time will not persist within the save by default. This is the prefered behavior, however if you have a stat that absolutely MUST persist between saves you can enable the "persist" boolean when registering a stat. However, you need to be extremely careful! If a user disables or uninstalls a module that added an Arb Variable (like ArbString) with persistence checked it will stay in that pal's data and in the save file until it is forcibly removed! To save memory, arb variables that are 0 or none/null are skipped while saving if they are set to only decay (or have no decay) / are a string. This means you can effectively remove an ArbVariable by setting its value to 0/none and it will be removed automatically even if persist is enabled. If, however, you set up a variable with no decay (or set an ArbString with persist) it will remain in memory with no way to clear itself automatically. Try not to cause save bloat with your module and be sparing with what you add, and if you can, do it without persist enabled!


~!~ API Explaination ~!~

References (Variables and Data)
	SCakeReference / ProjectSugarCake
		This is the reference to the Sugar Cake API and mod itself, you'll need a reference to SCake in-order to use any of the API functions
	
	EventReference / EventComp
		These are references to an instance of the Animation Player. This handles all animation playback and stores data related to that specific event. These are volitile after an animation ends so make sure to pull any needed data before the animation ends (or if pulling from an animation end call, grab and store the data immediately to avoid losing it!)
			- I recommend grabbing whatever data you need before the event ends, then just listen for the end event trigger and compare the reference. This is an effectively 'free' process and avoids issues.
	
	"Pal"
		For our purpose I've just labeled all characters internally as pals, including humans. If something references 'Pal' it means I'm referencing "PalCharacter" which is an internal Palworld class used for pretty much all actors in the game.

Events
	SCake_RegisterAnim
		Call to register an array of animations, invalid data may cause animations not to register
			RegisterAnimData [SCake_RegAnim_Struct]
				Array of animations you'd like to send to the register

	SCake_RegisterAnimEvent
		Call to register an array of animation events, invalid data may cause animation events not to register
			RegisterAnimEventData [SCake_RegAnimEvent_Struct]
				Array of animation events you'd like to send to the register

	SCake_RegisterAllJSON
		(Note : This function runs automatically when the mod loads up so you do not need to call this unless you alter the _LoadList afterward.)
		Registers all .json files in the _LoadList, call when registering new animations through the .json install method.
		
	SCake_SendReportMessage
		Passes a message for SCake to display in the ReportUI
			Message [String]
				Message to display

	SCake_StopAnim_PalTarget
		Stops any animation event the selected pal is involved in
			PalReference [Pal Character Reference]

	SCake_StopAnim_EventRef
		Attempts to stop the specificed Animation Event by reference
			EventReference [EventComp Reference]
		
Functions
	SCake_StartAnimEvent_Basic
		Starts an animation with minimal information. If no event ID is supplied (is either "None" or "Random") a random compatible animation will play instead
			PalList [Pal Character Reference]
				List of characters to include in the animation, can include humans or pals (including players)
			EventID [Name]
				[Optional] Animation Event to play, if is invalid or none is supplied a random compatible animation will be selected to play
			NonErotic [Boolean]
				[Optional] If no EventID is supplied, this determines if the random animation selected should be NonErotic (Overwritten by EventID if valid)
			Returns : ValidStart [Boolean]
				Returns if the animation had valid input and began playing
			Returns : ErrorOutput [Name]
				Returns an output message with any errors
			Returns : PalOrder [Pal Character Array]
				Returns the array of pals passed in the slot order they were sent in for the animation.

	SCake_StartAnimEvent_Advanced
		Starts an animation with more advanced information. If no event ID is supplied (is either "None" or "Random") a random compatible animation will play instead.
			PalList [Pal Character Reference]
				List of characters to include in the animation, can include humans or pals (including players)
			EventID [Name]
				[Optional] Animation Event to play, if is invalid or none is supplied a random compatible animation will be selected to play
			NonErotic [Boolean]
				[Optional] If no EventID is supplied, this determines if the random animation selected should be NonErotic (Overwritten by EventID if valid)
			Tags [Name Array]
				[Optional] Tags to search for when finding animations to play
			RequireAllTags [Boolean]
				[Optional] Whether all tags are required for an animation is compatible, if false then only a single tags is required
			Exclude Tags [Name Array]
				[Optional] Tags that invalidate animations as compatible, excluding them from results
			AnimRootTransform [Transform]
				Location where the animation should play (Can use a character's mesh world transform if desired)
			Returns : ValidStart [Boolean]
				Returns if the animation had valid input and began playing
			Returns : ErrorOutput [Name]
				Returns an output message with any errors
			Returns : PalOrder [Pal Character Array]
				Returns the array of pals passed in the slot order they were sent in for the animation.

	SCake_GetEventCompParams
		Returns variables from the provided EventReference
			EventReference [EventComp Reference]
				The Animation Event Reference you wish to pull data from
			Returns : PalList [Pal Character Reference Array]
				Returns a list of characters in the Animation Event in Slot Order
			Returns : NonErotic [Boolean]
				Returns if the animation is NonErotic (if you're triggering sex effects or only want Erotic animations, make sure to check if this for false)
			Returns : AnimRoot [Transform]
				Returns the world position for the animation before any offsets (if you need character positions it's better to use their reference directly)

	SCake_Stat_AddPleasure
		Adds Sexual Pleasure to the referenced character
				PalReference [Pal Character Reference]
					Character to add Sexual Pleasure to
				AmountToAdd [Float]
					Amount of Sexual Pleasure to add
				Returns : PleasureOutput [Float]
					The new amount of Sexual Pleasure the referenced character

	SCake_CheckStat_Pleasure
		Returns the current Sexual Pleasure of the referenced character
			PalToCheck [Pal Character Reference]
				Which character to check the Sexual Pleasure of
			Returns: SexualPleasure [Float]
				The Sexual Pleasure of the checked character

	SCake_GetPalAnim
		Checks if the given pal is in an animation and if so returns the Event Reference
			PalReference [Pal Character Reference]
				Pal Character reference to search through the playering Animation Event List for
			Returns : InAnimation [Boolean]
				Whether the character was found in the playing Animation Event List
			Returns : EventReference [EventComp Reference]
				If InAnimation was true, returns the EventComp Reference

	SCake_InterpretError
		Takes the Name variable from an error and translates it into a human readable string for use in either UI elements or easier debugging
			ErrorInput [Name]
				The raw error name variable from SCake
			Returns : ReadableOutput [String]
				Readable string ready for use

	SCake_AdjustAnimCamPos
		Adjusts the player camera position while in animations (Starts off the saved position then offsets by the input amount)
			AdjustPos [Vector]
				Ammount to offet the camera to compared to the saved position
			SavePos [Boolean]
				Whether the new position should be saved or just adjust this once
			Returns : FinalPos [Vector]
				Offset after adding the AdjustPos amount

	SCake_TraceForPal
		Uses a line-trace to search for pals, useful to target and apply code to pals the player is looking at. (Uses the camera position and rotation, not all pals are able to be detected this way so this is mostly for debug purposes)
			Distance [Integer]
				Distance from the camera to check in UE units
			Returns : Valid [Boolean]
				Whether the trace found a valid pal
			Returns : PalFound [Pal Character]
				Pal Reference the trace found

	SCake_TrackReturnAll
		Returns referneces for all valid pals currently being tracked by SCake (Useful if you need to grab references when starting up your module and/or need to apply/check status)
			Returns: PalsTracked [Pal Character Reference Array]

	SCake_CheckStat_SexHeat
		Returns the Pal Reference's associated Sex Heat value along with if they have enough to currently be aroused
			PalReference [Pal Character Reference]
			Returns : SexHeat [Float]
				Current Sexual Heat value, typically seen as a percentage with 100 having '100%' of Heat's effect
			Returns : IsAroused [Boolean]
				Whether the current Heat value is above the character's arousal threshold

	SCake_Stat_AddSexHeat
		Adds the given amount to the specified characters's Sexual Heat status and returns the new value along with if the character has enough Heat to be aroused
			PalReference [Pal Character Reference]
				Character to add Sexual Heat to
			AmountToAdd [Float]
				Amount to add to the Sexual Heat stat
			Returns : SexHeat [Float]
				New Sexual Heat stat of the given character
			Returns : IsAroused [Boolean]
				Whether the new value has the character's Sexual Heat high enough to be aroused

	SCake_Stat_ArbChangeString
		Either Adds or Changes the Arbitrary String by Name for the designated character (Used to store additional stats for modules)
			PalReference [Pal Character Reference]
				Character to add/change the value for
			ArbName [Name]
				Name to give the string, using the same name as a registered string to change the value
			ArbString [String]
				String to set the value to
			Persist [Boolean]
				Whether this value should persist within the save data or not

	SCake_CheckStat_ArbString
		Returns the ArbString if one is defined for the designated character, if none is defined then none will be returned
			PalRefernce [Pal Character Reference]
				The character to get the stat from
			ArbName [Name]
				Name the ArbString is registered under
			Returns : ArbString [String]
				String value for the given ArbName
			Returns : Persists [Boolean]
				Whether this ArbVariable is set to persist or not

Dispatchers
	SCake_ED_AnimStart
		Called whenever an Animation Event starts and returns a reference to it (Store this value if you need to reference it later, use the API call 'SCake_GetEventCompParams' to pull data from the event, store it if needed)
			Returns : EventReference [EventComp Reference]
			Returns : PalList [Pal Character Reference Array]
				List of characters in the animation in their slot order

	SCake_ED_AnimEnd
		Called whenever an Animation Event starts and returns a refernece to it (It's recommended to pull data immediately using 'SCake_GetEventCompParams' if needed as EventReferences become volitile after an Animation Event Ends, I recommend mostly using this reference to compare to stored references from other API calls)
			Returns : EventReference [EventComp Reference]
			Returns : PalList [Pal Character Reference Array]
				List of characters in the animation in their slot order

	SCake_ED_EventOrgasm
		Called whenever an Animation Event triggers climax
			Returns : EventReference [EventComp Reference]
				Reference to the specific event
			Returns : PalsOrgasmed [Pal Character Reference Array]
				Characters who orgasmed in the event
			
	SCake_ED_PalOrgasm
		Called from individual pals who orgasm
			Returns : PalReference [Pal Character Reference]
				The pal who orgasmed

	SCake_ED_PalAroused
		Called when a pal reaches enough Heat to enter an aroused state
			Returns : PalReference [Pal Character Reference]

	SCake_ED_TrackPalEnabled
		Called when a pal becomes active in the tracker
			Returns : PalReference [Pal Character Reference]

	SCake_ED_TrackPalDisabled
		Called when a pal becomes inactive in the tracker (Note : Pals do not instantly start tracking or instantly stop tracking when they become valid/invalid, do not use this for validity checks! Use 'IsValid' through UE natively instead!)
			Returns : PalReference [Pal Character Reference]